package com.chenjt.jvm.second.three_instruct;

/**
 * 注释：
 *
 * 指令9：同步控制指令
 *
 * @author chenjt
 * @date 2025/6/30 14:45
 */
public class SynchronizedTest {

    private int i = 0;
    public synchronized void add() {
        i++;
    }

    private Object obj = new Object();
    public void subtract(){
        synchronized (obj){
            i--;
        }
    }

}
